import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/record_list_entity.dart';

RecordListEntity $RecordListEntityFromJson(Map<String, dynamic> json) {
  final RecordListEntity recordListEntity = RecordListEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    recordListEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    recordListEntity.msg = msg;
  }
  final List<RecordListData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<RecordListData>(e) as RecordListData)
      .toList();
  if (data != null) {
    recordListEntity.data = data;
  }
  return recordListEntity;
}

Map<String, dynamic> $RecordListEntityToJson(RecordListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension RecordListEntityExtension on RecordListEntity {
  RecordListEntity copyWith({
    int? code,
    String? msg,
    List<RecordListData>? data,
  }) {
    return RecordListEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

RecordListData $RecordListDataFromJson(Map<String, dynamic> json) {
  final RecordListData recordListData = RecordListData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    recordListData.id = id;
  }
  final int? articleId = jsonConvert.convert<int>(json['article_id']);
  if (articleId != null) {
    recordListData.articleId = articleId;
  }
  final int? channelId = jsonConvert.convert<int>(json['channel_id']);
  if (channelId != null) {
    recordListData.channelId = channelId;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    recordListData.title = title;
  }
  final String? categoryText = jsonConvert.convert<String>(
      json['category_text']);
  if (categoryText != null) {
    recordListData.categoryText = categoryText;
  }
  final int? categoryId = jsonConvert.convert<int>(json['category_id']);
  if (categoryId != null) {
    recordListData.categoryId = categoryId;
  }
  final String? roleText = jsonConvert.convert<String>(json['role_text']);
  if (roleText != null) {
    recordListData.roleText = roleText;
  }
  final int? roleId = jsonConvert.convert<int>(json['role_id']);
  if (roleId != null) {
    recordListData.roleId = roleId;
  }
  final int? userId = jsonConvert.convert<int>(json['user_id']);
  if (userId != null) {
    recordListData.userId = userId;
  }
  final String? channelName = jsonConvert.convert<String>(json['channel_name']);
  if (channelName != null) {
    recordListData.channelName = channelName;
  }
  final String? userName = jsonConvert.convert<String>(json['user_name']);
  if (userName != null) {
    recordListData.userName = userName;
  }
  final String? addTime = jsonConvert.convert<String>(json['add_time']);
  if (addTime != null) {
    recordListData.addTime = addTime;
  }
  final String? sellPrice = jsonConvert.convert<String>(json['sell_price']);
  if (sellPrice != null) {
    recordListData.sellPrice = sellPrice;
  }
  final String? imgUrl = jsonConvert.convert<String>(json['img_url']);
  if (imgUrl != null) {
    recordListData.imgUrl = imgUrl;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    recordListData.status = status;
  }
  final int? guid = jsonConvert.convert<int>(json['guid']);
  if (guid != null) {
    recordListData.guid = guid;
  }
  final int? isSelf = jsonConvert.convert<int>(json['is_self']);
  if (isSelf != null) {
    recordListData.isSelf = isSelf;
  }
  final String? gameAccount = jsonConvert.convert<String>(json['game_account']);
  if (gameAccount != null) {
    recordListData.gameAccount = gameAccount;
  }
  return recordListData;
}

Map<String, dynamic> $RecordListDataToJson(RecordListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['article_id'] = entity.articleId;
  data['channel_id'] = entity.channelId;
  data['title'] = entity.title;
  data['category_text'] = entity.categoryText;
  data['category_id'] = entity.categoryId;
  data['role_text'] = entity.roleText;
  data['role_id'] = entity.roleId;
  data['user_id'] = entity.userId;
  data['channel_name'] = entity.channelName;
  data['user_name'] = entity.userName;
  data['add_time'] = entity.addTime;
  data['sell_price'] = entity.sellPrice;
  data['img_url'] = entity.imgUrl;
  data['status'] = entity.status;
  data['guid'] = entity.guid;
  data['is_self'] = entity.isSelf;
  data['game_account'] = entity.gameAccount;
  return data;
}

extension RecordListDataExtension on RecordListData {
  RecordListData copyWith({
    int? id,
    int? articleId,
    int? channelId,
    String? title,
    String? categoryText,
    int? categoryId,
    String? roleText,
    int? roleId,
    int? userId,
    String? channelName,
    String? userName,
    String? addTime,
    String? sellPrice,
    String? imgUrl,
    int? status,
    int? guid,
    int? isSelf,
    String? gameAccount,
  }) {
    return RecordListData()
      ..id = id ?? this.id
      ..articleId = articleId ?? this.articleId
      ..channelId = channelId ?? this.channelId
      ..title = title ?? this.title
      ..categoryText = categoryText ?? this.categoryText
      ..categoryId = categoryId ?? this.categoryId
      ..roleText = roleText ?? this.roleText
      ..roleId = roleId ?? this.roleId
      ..userId = userId ?? this.userId
      ..channelName = channelName ?? this.channelName
      ..userName = userName ?? this.userName
      ..addTime = addTime ?? this.addTime
      ..sellPrice = sellPrice ?? this.sellPrice
      ..imgUrl = imgUrl ?? this.imgUrl
      ..status = status ?? this.status
      ..guid = guid ?? this.guid
      ..isSelf = isSelf ?? this.isSelf
      ..gameAccount = gameAccount ?? this.gameAccount;
  }
}